package Test;

import static org.junit.Assert.*;

import java.util.ArrayList;

import DBLayer.DBDepartment;
import org.junit.Test;

import ModelLayer.Department;

public class DBDepartmentTest {

    @Test
    public void testGetAllDepartment() {
        DBDepartment dbObj = new DBDepartment();
        ArrayList<Department> depObj = dbObj.getAllDepartment(false);

        if (depObj != null){
            for (Department d : depObj){
                System.out.println(d.getDname());
            }
        }
        else {
            fail("Department not found");
        }
    }

    @Test
    public void testFindDepartment() {
        DBDepartment dbObj = new DBDepartment();

        Department depObj = dbObj.findDepartment(4, false);

        if (depObj != null) {
            System.out.println("Department found" + depObj.getDname());
        }
        else {
            fail("Department not found");
        }
    }

    @Test
    public void testSearchDeparmentOnName() {
        DBDepartment dbObj = new DBDepartment();

        Department depObj = dbObj.searchDeparmentOnName("Research", false);

        if (depObj != null) {
            System.out.println("Department found" + depObj.getDname());
        }
        else {
            fail("Department not found");
        }
    }
}


